<!-- subpkg_medicine/pay_result/index.vue -->
<script lang="ts" setup>
  import { useMedic } from '@/hooks'
  import { getMedicalOrderDetail } from '@/pages/apis/order'
  import type { MedicalOrderDetail } from '@/types/order'
  import { ref } from 'vue'

  // 获取地址参数
  const props = defineProps<{ orderId: string }>()
  // 1. 药品订单详情
  // const orderDetail = ref({} as MedicalOrderDetail)
  // // 查询订单详情
  // const getOrderDetail = async () => {
  //   const data = await getMedicalOrderDetail(props.orderId)
  //   orderDetail.value = data
  // }
  // getOrderDetail()
  const { orderDetail } = useMedic(props.orderId)

  const consoleLog = () => {
    console.log(orderDetail.value.id)
  }
</script>
<template>
  <view class="pay-result-page">
    <view class="result">
      <uni-icons size="70" color="#20c6b2" type="checkbox-filled" />
      <view class="amount">¥ {{ orderDetail.payment }}</view>
      <view class="label">支付成功</view>
      <view class="tips" @click="consoleLog">订单支付成功，已通知药房尽快发出，请耐心等待~</view>
    </view>

    <view class="buttons">
      <navigator
        hover-class="none"
        :url="`/subpkg_medicine/order_detail/index?id=${orderDetail.id}`"
        class="uni-button"
      >
        查看订单
      </navigator>
      <navigator
        hover-class="none"
        url="/subpkg_consult/room/index"
        open-type="redirect"
        class="uni-button plain"
      >
        返回诊室
      </navigator>
    </view>
  </view>
</template>

<style lang="scss">
  @import './index.scss';
</style>
